1. Field of the Invention
This invention relates to a method of and an apparatus for calculating a binary-coding threshold value on the basis of which an image signal obtained by an image input apparatus such as an image scanner is binary-coded when the image represented by the image signal is to be printed by, for instance, a stencil printer.
2. Description of the Related Art
The stencil printer has been wide used since it is short in printing time and low in cost. In the stencil printer, image processing and pixel value conversion processing are carried out on an image signal representing an image read by an image reader and the processed image signal is binary-coded, thereby obtaining a binary-coded image signal. Then a thermal head having an array of heater elements is driven on the basis of the binary-coded image signal so that the heater elements are selectively energized to imagewise perforate a stencil material, thereby obtaining a stencil. Printing is made by transferring ink from one side of the stencil to the other side through the perforations.
As a method of binary-coding the image signal, a method in which a single binary-coding threshold value is employed, for instance, when the image signal is of 256 tones, 0 to 255, the middle value 127 is taken as a binary-coding threshold value and tones equal to or higher than 127 are converted to 1 (black) while those lower than 127 are converted to 0 (white), has been wide used. However, the method in which a single binary-coding threshold value is employed is disadvantageous in that when the background of an original is high in density like a newspaper, the threshold value becomes too low and as a result, the binary-coded image represented by the binary-coded image signal becomes dark in total, which makes characters hard to read.
Accordingly, there have been proposed various methods of calculating the binary-coding threshold value including a mean value method and a P-tile method. In the mean value method, a mean value of the densities in a predetermined region of the original or in the entire region of the original is taken as a binary-coding threshold value, and in the P-tile method, a density distribution in a predetermined region of the original is obtained and the density which will make black P% of the predetermined region when the image signal is binary-coded with the density taken as the threshold value is taken as the binary-coding threshold value.
However, the mean value method gives rise to a problem that the threshold value becomes too high and the density of the binary-coded image is lowered when the original includes noise or an image on the back side of the original is seen through the paper. The P-tile method gives rise to a problem that when the original includes a region which is different in density and size of characters from the region which is used to obtain the binary-coding threshold value, the density of the region can be increased or reduced.
In view of the foregoing observations and description, the primary object of the present invention is to provide a method of and an apparatus for calculating a binary-coding threshold value which can properly calculate the binary-coding threshold value.
In accordance with a first aspect of the present invention, there is provided a method of calculating a binary-coding threshold value on the basis of which an image signal is binary-coded, the method comprising the steps of
making a histogram representing a frequency distribution of tones of the image signal,
calculating the value of a peak tone at which the frequency is maximized,
calculating as a first tone at which the frequency becomes equal to a predetermined level on the lower tone side of the peak tone,
calculating a reference binary-coding threshold value by adding to the peak tone the difference between the first tone and the peak tone, and
determining the binary-coding threshold value on the basis of the reference binary-coding threshold value.
The peak tone generally corresponds to a peak of frequency in the histogram. When there are plurality of peaks of frequency, the tone corresponding to the highest peak is taken as the peak tone.
The xe2x80x9cpredetermined levelxe2x80x9d is a frequency level which is determined on the basis of histograms for image signals read out from various originals so that the frequency at the peak tone of the histogram is higher than the xe2x80x9cpredetermined levelxe2x80x9d for substantially all the image signals.
The expression xe2x80x9cdetermining the binary-coding threshold value on the basis of the reference binary-coding threshold valuexe2x80x9d means to determines the binary-coding threshold value, for instance, in the following manner. That is, a plurality of binary-coding threshold values are set for each given reference binary-coding threshold value and the image signal S is binary-coded on the basis of the respective binary-coding threshold values and printing is made on the basis of the binary-coded image signal. Then the binary-coding threshold value which gives a print of the highest quality is taken as the binary-coding threshold value for the reference binary-coding threshold value. This procedure is repeated for each value of the reference binary-coding threshold value and the reference binary-coding threshold value is related to the binary-coding threshold value as a table. Then the binary-coding threshold value for a given reference binary-coding threshold value is determined according to the table.
It is preferred that when the sum of the frequencies at tones higher than a predetermined low value is higher than the sum of the frequencies at tones not higher than the predetermined low value, the tone at which the frequency becomes equal to the predetermined level on the higher tone side of the peak tone be taken as the reference binary-coding threshold value.
For example, the predetermined low value is set to a tone at the peak of a histogram made on the basis of an image signal read from a white reference original. For example, when the area of the background of the original is very large and the background is very white, the sum of the frequencies at tones lower than a predetermined low value is higher than the sum of the frequencies at tones not lower than the predetermined low value.
It is preferred that when the frequency at the peak tone is lower than the predetermined level, when the sum of the frequencies at tones higher than a predetermined high value is higher than the sum of the frequencies at tones not higher than the predetermined high value, and/or when at least one of the peak tone, the first tone and the reference binary-coding threshold value is higher than the predetermined high value, the reference binary-coding threshold value be set to a predetermined tone.
For example, the predetermined high value is set to a tone at the peak of a histogram made on the basis of an image signal read from a black reference original. That the frequency at the peak tone is lower than the predetermined level means that no peak exists in the histogram or that the frequency at the peak tone is very low. For example, when the area of characters and/or drawings of the original is very large or the density of the background is very high, the sum of the frequencies at tones lower than a predetermined high value is higher than the sum of the frequencies at tones not lower than the predetermined high value, or at least one of the peak tone, the first tone and the reference binary-coding threshold value is higher than the predetermined high value.
In accordance with a second aspect of the present invention, there is provided an apparatus for calculating a binary-coding threshold value on the basis of which an image signal is binary-coded, the apparatus comprising
a histogram making means which makes a histogram representing a frequency distribution of tones of the image signal,
a peak tone calculating means which calculates the value of a peak tone at which the frequency is maximized,
a first tone calculating means which calculates as a first tone at which the frequency becomes equal to a predetermined level on the lower tone side of the peak tone,
a reference binary-coding threshold value calculating means which calculates a reference binary-coding threshold value by adding to the peak tone the difference between the first tone and the peak tone, and
a binary-coding threshold value determining means which determines the binary-coding threshold value on the basis of the reference binary-coding threshold value.
It is preferred that the reference binary-coding threshold value calculating means be provided with a determining means which determines whether the sum of the frequencies at tones higher than a predetermined low value is higher than the sum of the frequencies at tones not higher than the predetermined low value, and takes the tone at which the frequency becomes equal to the predetermined level on the higher tone side of the peak tone as the reference binary-coding threshold value when the determining means determines that the sum of the frequencies at tones higher than a predetermined low value is higher than the sum of the frequencies at tones not higher than the predetermined low value.
It is preferred that the reference binary-coding threshold value calculating means be provided with a determining means which determines whether the frequency at the peak tone is lower than the predetermined level, whether the sum of the frequencies at tones higher than a predetermined high value is higher than the sum of the frequencies at tones not higher than the predetermined high value, and whether at least one of the peak tone, the first tone and the reference binary-coding threshold value is higher than the predetermined high value, and sets the reference binary-coding threshold value to a predetermined tone when the determining means determines that the frequency at the peak tone is lower than the predetermined level, that the sum of the frequencies at tones higher than a predetermined high value is higher than the sum of the frequencies at tones not higher than the predetermined high value, or that at least one of the peak tone, the first tone and the reference binary-coding threshold value is higher than the predetermined high value.
In a histogram representing a frequency distribution of tones of an image signal, tones representing the background of the original appear most frequently except the case where the image signal is read out from an original which is entirely black or white. Accordingly, the peak tone represents tones of the background of the original. The first tone represents the lowest tone of the background of the original. Further, the histogram for an original without characters or drawings (an original having only a background) is generally symmetric about the peak tone. Accordingly, the reference binary-coding threshold value obtained by adding to the peak tone the difference between the first tone and the peak tone is substantially equal to the highest tone of the background of the original without characters or drawings (an original having only a background). Accordingly, when the binary-coding threshold value is determined on the basis of the reference binary-coding threshold value and the image signal is binary-coded on the basis of the binary-coding threshold value thus obtained, a binary-coded image signal in which the background is clearly separated from characters and drawings can be obtained.